package shoplist;
import java.util.Scanner;
public class shoplist {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        shoplz[] shop=new shoplz[100];
        do{
            print1();
            int num1=sc.nextInt();
            switch(num1){
                case 1:
                    payshop(shop);
                    break;
                case 2:
                    addshop(shop);
                    break;
                case 3:
                    modifyshop(shop);
                    break;
                case 4:
                    lookupshop(shop);
                    break;
                default:
                    System.out.println("输入错误请重新输入");
                    break;
            }

        }while(num1);
    }
}
public static void print1(){
    System.out.println("===============请选择一下的菜单=============");
    System.out.println("1.对买的东西进行付款");
    System.out.println("2.增加选购的物品");
    System.out.println("3.修改所买的物品");
    System.out.println("4.查看选购的物品");
    System.out.println("0.结束选购");
}
public static addshop(shoplz[] shop ){
    Scanner sc=new Scanner(System.in);
    shoplz shop1=new shoplz();
    static int i=0;
    System.out.println("输入商品的名称：");
    shop1.name=sc.next();
    System.out.println("输入商品的价格:");
    shop1.price=sc.nextInt();
    System.out.println("输入商品的数量:");
    shop1.number=sc.nextInt();
    System.out.println("输入商品的编号：");
    shop1.shopnum=sc.nextInt();
    shop[i]=shop1;
    i++;


}
public static payshop(shoplz[] shop){
    double money = 0;
    for (int i = 0; i < shop.length; i++) {
        // Article a = shopCar[i];
        if(shop[i] !=null){
            money += (shop[i].price * shop[i].shopnum);
        }else {
            break;
        }
    }
    System.out.println("本次商品购买的总价为：" + money);
}
public static modifyshop(shoplz[] shop){

}
public static lookupshop(shoplz[] shop){

}
